package MapDemo;

import java.util.HashMap;
import java.util.Iterator;
import java.util.Set;

public class HashMapDemo {
    public static void main(String[] args) {
        HashMap<String, Integer> map = new HashMap<String, Integer>();
        map.put("刘德华",50);
        map.put("张学友",45);
        map.put("黎明",48);
        map.put("郭富城",50);
        map.put("刘德华",50);
        Set<String> keys = map.keySet();
        for (Iterator<String> it = keys.iterator();it.hasNext();) {
            String key = it.next();
            Integer value = map.get(key);
            System.out.println(key + "=" + value);
        }
        for (String key : keys) {
            Integer value = map.get(key);
            System.out.println(key + "=" + value);
        }
    }
}
